Support Forum

Create a size gradient for a large number (>400) of single objects



Sunday 9th December 2018
Hello, I have the following problem. I would like to create a shape for example a circle. It has a defined size for example 3mm. Now, the question is if I could create an array in which the size of the object gradually decreases for example down to 300 micrometers over a distance of 2.5cm. Is there an easy way to do it? Thanks a lot! David
Jürgen
LayoutEditorFull
Sunday 9th December 2018
Attachments:
(only for registered users)

circle.png

That is an typical application for a small macro. This macro should be closed to what you need: ``` #!/usr/bin/layout #name=circles with different sizes #help=circles with different sizes int main() { int radius_max=300000; int radius_min=300; int step=500; int x=0; int y=0; int layer=1; for (int radius=radius_max;radius>radius_min;radius-=step){ point center; center.set(x,y); layout->drawing->currentCell->addCircle(layer,center,radius); x+=2*radius+100; if (x>20000000) { y+=3*radius; x=0;} } layout->drawing->scaleFull(); } ``` ![circle.png](/api/img.php?thread=20181209-af62&file=circle.png)


Sunday 9th December 2018
Thanks. It helps for the beginning. If I want to do different shapes - triangles, squares, polygons - and I want to maintain the number in each line. What should I adjust in the code? Would it work in the free version as well? Thanks a lot! David
Jürgen
LayoutEditorFull
Sunday 9th December 2018
Instead of addCircle(layer,center,radius) you can call addBox, addPath and all other method the class cell can offer https://layouteditor.org/layoutscript/api/cell


Sunday 9th December 2018
Can I also add some shapes from the library?
Jürgen
LayoutEditorFull
Sunday 9th December 2018
To use shapes from the parametric shape library you need to copy&paste the code from the corresponding macro to the new created macro.